<?php
/* $Revision: 1.13 $ */
/* pdf-php by R&OS code to set up a new sales order page */
if ($PageNumber>1){
	$pdf->newPage();
}

//$XPos = $Page_Width/2 - 60;
$XPos = 60;
/* if the deliver blind flag is set on the order, we do not want to output
the company logo */
if ($DeliverBlind < 2) {
    //$pdf->addJpegFromFile($_SESSION['LogoFile'],$XPos+20,520,0,60);
    $pdf->addJpegFromFile($_SESSION['LogoFile'],$XPos+40,520,0,60);    
}
$FontSize=18;

if ($Copy=='Customer'){
	$pdf->addText(280, 420,$FontSize, _('PACKING LIST') . ' - ' . _('Customer Copy') );
} else {
	$pdf->addText(280, 420,$FontSize, _('PACKING LIST') . ' - ' . _('Office Copy') );
}

/* if the deliver blind flag is set on the order, we do not want to output
the company contact info */
if ($DeliverBlind < 2) {
    $FontSize=14;
    $YPos = 500;
    $pdf->addText($XPos, $YPos,$FontSize, $_SESSION['CompanyRecord']['coyname']);
    $FontSize =8;
    $pdf->addText($XPos, $YPos-12,$FontSize, $_SESSION['CompanyRecord']['regoffice1']);
    $pdf->addText($XPos, $YPos-21,$FontSize, $_SESSION['CompanyRecord']['regoffice2']);
    $pdf->addText($XPos, $YPos-30,$FontSize, $_SESSION['CompanyRecord']['regoffice3'] . ' ' . $_SESSION['CompanyRecord']['regoffice4'] . ' ' . $_SESSION['CompanyRecord']['regoffice5']);
    $pdf->addText($XPos, $YPos-39,$FontSize, _('Ph') . ': ' . $_SESSION['CompanyRecord']['telephone'] . ' ' . _('Fax'). ': ' . $_SESSION['CompanyRecord']['fax']);
    $pdf->addText($XPos, $YPos-48,$FontSize, $_SESSION['CompanyRecord']['email']);
}

$XPos = 400;
$YPos = 360;

$FontSize=14;
$pdf->addText($XPos, $YPos,$FontSize, _('SHIP TO').':' );
$pdf->addText($XPos, $YPos-15,$FontSize, $myrow['deliverto']);
$pdf->addText($XPos, $YPos-30,$FontSize, $myrow['deladd1']);
$pdf->addText($XPos, $YPos-45,$FontSize, $myrow['deladd2']);
$pdf->addText($XPos, $YPos-60,$FontSize, $myrow['deladd3'] . ' ' . $myrow['deladd4'] . ' ' . $myrow['deladd5']);

//$YPos -= 80;
$XPos = 46;
$YPos = 360;

$pdf->addText($XPos, $YPos,$FontSize, _('Customer').':');
$pdf->addText($XPos, $YPos-15,$FontSize, $myrow['name']);
$pdf->addText($XPos, $YPos-30,$FontSize, $myrow['address1']);
$pdf->addText($XPos, $YPos-45,$FontSize, $myrow['address2']);
$pdf->addText($XPos, $YPos-60,$FontSize, $myrow['address3'] . ' ' . $myrow['address4'] . ' ' . $myrow['address5']);


//$pdf->addText($XPos, $YPos-82,$FontSize, _('Customer No.'). ' : ' . $myrow['debtorno']);
//$pdf->addText($XPos, $YPos-100,$FontSize, _('Shipped by'). ' : ' . $myrow['shippername']);

//$LeftOvers = $pdf->addTextWrap($XPos,$YPos-115,170,$FontSize,stripcslashes($myrow['comments']));

if (strlen($LeftOvers)>1){
	$LeftOvers = $pdf->addTextWrap($XPos,$YPos-130,170,$FontSize,$LeftOvers);
	if (strlen($LeftOvers)>1){
		$LeftOvers = $pdf->addTextWrap($XPos,$YPos-145,170,$FontSize,$LeftOvers);
		if (strlen($LeftOvers)>1){
			$LeftOvers = $pdf->addTextWrap($XPos,$YPos-160,170,$FontSize,$LeftOvers);
			if (strlen($LeftOvers)>1){
				$LeftOvers = $pdf->addTextWrap($XPos,$YPos-175,170,$FontSize,$LeftOvers);
			}
		}
	}
}

$pdf->addText(620, 400,$FontSize, _('Order No'). ':');
$pdf->addText(700, 400,$FontSize, $_GET['TransNo']);
//$pdf->addText(620, 560-15,$FontSize, _('Your Ref'). ':');
//$pdf->addText(700, 560-15,$FontSize, $myrow['customerref']);
$pdf->addText(620, 400-15,$FontSize,  _('Order Date'). ':');
$pdf->addText(700, 400-15,$FontSize,  ConvertSQLDate($myrow['orddate']));
//$pdf->addText(620, 560-60,$FontSize,  _('Printed') . ': ');
//$pdf->addText(700, 560-60,$FontSize,  Date($_SESSION['DefaultDateFormat']));
//$pdf->addText(620, 560-75,$FontSize,  _('From').': ');
//$pdf->addText(700, 560-75,$FontSize,  $myrow['locationname']);
//$pdf->addText(620, 560-90,$FontSize,  _('Page'). ':');
//$pdf->addText(700, 560-90,$FontSize,  $PageNumber);

//$YPos -= 170;
$YPos -= 100;
$XPos = 15;

$header_line_height = $line_height+25;

$LeftOvers = $pdf->addTextWrap($XPos,$YPos,127,$FontSize, _('Part No.'),'left');
$LeftOvers = $pdf->addTextWrap(147,$YPos,255,$FontSize, _('Description'),'left');
$LeftOvers = $pdf->addTextWrap(200,$YPos,200,$FontSize, _('P/O No.'),'right');
$LeftOvers = $pdf->addTextWrap(400,$YPos,85,$FontSize, _('Quantity'),'right');
$LeftOvers = $pdf->addTextWrap(503,$YPos,85,$FontSize,_('This Del'),'right');
$LeftOvers = $pdf->addTextWrap(602,$YPos,85,$FontSize, _('Prev Dels'),'right');


$YPos -= $line_height;

$FontSize =12;

?>
